{include file="public/_meta" /}
<title>标签列表</title>
<style>
  input{
    border:none;
  }
  .text-c td:nth-chid
</style>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 轮播列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" onclick="ooo()" title="清楚缓存" ><i class="Hui-iconfont">&#xe706;</i></a>
</nav>
<div class="page-container">
  <!-- <div class="text-c"> 
    <input type="text" class="input-text" style="width:250px" placeholder="输入用户名称" id="" name="us_name">
    <button type="submit" class="btn btn-success" name=""><i class="Hui-iconfont">&#xe665;</i>搜用户</button>
  </div> -->
  <table class="table table-border table-bordered table-bg">
    
    <thead>
      
      <tr class="text-c">
        <th width="200">图片</th>
        <th width="200">链接</th>
        <th width="200">操作</th>
      </tr>
    </thead>
    <form action="">
    <tbody>
      {volist name='array' id="vo"}
      <tr class="text-c">
          <td>
            <div style="position: relative;width: 100px;height: 50px;    margin: auto;">
            <img src="{$vo|default='/static/admin/img/add0.png'}" style="width:100px;height:50px" class="logo{$i}" alt="">
            <input type="file" name="file" onchange="eee($(this),{$i})" class="input-text" style="position: absolute;left: 0;top: 0;width: 100%;height: 100%;opacity: 0;">
            <input type="text" name="{$i}" hidden="hidden" value="{$vo}" class="pic{$i}" >
          </div>
        </td>
        <td>
          1111111111111111111111111111111
        </td>
        <td>
          <a style="text-decoration:none" onclick="del(this)">删除</a>
        </td>
      </tr>
      {/volist}
    </tbody>

    </form>
  </table>
  <div class="row cl">
    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2" style="    text-align: center;margin-top: 50px;">
      <button onclick="return edit();" class="btn btn-primary radius" type="submit"><i clsass="Hui-iconfont">&#xe632;</i> 保存</button>
    </div>
  </div>
</div>
{include file="public/_footer" /}

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/static/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/static/admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
  $(function(){
    // console.log($("").val(111))
    
  })
  function eee(dada,i) {
        var data = new FormData();
        data.append('file', dada[0].files[0]);
        var index = layer.load(1, { shade: false }); //0代表加载的风格，支持0-2
        $.ajax({
            url: '{:url("store/upload")}',
            type: 'POST',
            data: data,
            cache: false,
            contentType: false,
            processData: false,
            success: function(data) {
                // layer.msg(data.msg);
                layer.close(index);
                if (data.code) {
                    $('.logo'+i).attr('src',data.data);
                    $('.pic'+i).val(data.data);
                }
                layer.close(index);
            },
            error: function() {
                layer.close(index);
                layer.msg('上传出错');
            }
        });
    }
  function edit(){
    console.log(123);
      $.ajax({
        type:"post",
        url:"{:url('shuffling')}",
        data:$('form').serialize(),
        success:function(data){
          layer.msg(data.msg);
          if(data.code){
            setTimeout(function() {
               location.href = '';
            }, 500);
          }
        }
      })
    }
    function del(data){
      $(data).parent().parent().remove();
    }
    function ooo(){
  $.post("{:url('every/clear')}").success(function(data){
    layer.msg('清除成功');
  });
  return false;
}
</script>
</body>
</html>